/*

  See http://www.galasoft.ch/mvvm
*/

using CommonServiceLocator;
using GalaSoft.MvvmLight.Ioc;

namespace HuiZe.education.ViewModel
{
    /// <summary>
    /// This class contains static references to all the view models in the
    /// application and provides an entry point for the bindings.
    /// </summary>
    public class ViewModelLocator
    {
        /// <summary>
        /// Initializes a new instance of the ViewModelLocator class.
        /// </summary>
        public ViewModelLocator()
        {
            ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);

            ////if (ViewModelBase.IsInDesignModeStatic)
            ////{
            ////    // Create design time view services and models
            ////    SimpleIoc.Default.Register<IDataService, DesignDataService>();
            ////}
            ////else
            ////{
            ////    // Create run time view services and models
            ////    SimpleIoc.Default.Register<IDataService, DataService>();
            ////}

            SimpleIoc.Default.Register<MainViewModel>();
            SimpleIoc.Default.Register<LoginViewModel>();
            SimpleIoc.Default.Register<HomeViewModel>();
            SimpleIoc.Default.Register<PlanLessonViewModel>();
            SimpleIoc.Default.Register<PopupViewModel>();
            SimpleIoc.Default.Register<StudentViewModel>();
            SimpleIoc.Default.Register<ResourceCenterViewModel>();
            SimpleIoc.Default.Register<AttendClassViewModel>();
            SimpleIoc.Default.Register<TrainViewModel>();
            SimpleIoc.Default.Register<ShareResourceViewModel>();
            SimpleIoc.Default.Register<RandomAnswerShowViewModel>();
            SimpleIoc.Default.Register<CountDownViewModel>();
            SimpleIoc.Default.Register<AttendanceViewModel>();
        }

        public AttendanceViewModel AttendanceViewModel
        {
            get
            {
                return ServiceLocator.Current.GetInstance<AttendanceViewModel>();
            }
        }
        public CountDownViewModel CountDownViewModel
        {
            get
            {
                return ServiceLocator.Current.GetInstance<CountDownViewModel>();
            }
        }
        public RandomAnswerShowViewModel RandomAnswerShowView
        {
            get
            {
                return ServiceLocator.Current.GetInstance<RandomAnswerShowViewModel>();
            }
        }
        public TrainViewModel TrainView
        {
            get
            {
                return ServiceLocator.Current.GetInstance<TrainViewModel>();
            }
        }

        public AttendClassViewModel AttendClassView
        {
            get
            {
                return ServiceLocator.Current.GetInstance<AttendClassViewModel>();
            }
        }

        public ResourceCenterViewModel ResourceCenterView
        {
            get
            {
                return ServiceLocator.Current.GetInstance<ResourceCenterViewModel>();
            }
        }
        public ShareResourceViewModel ShareResourceView
        {
            get
            {
                return ServiceLocator.Current.GetInstance<ShareResourceViewModel>();
            }
        }

        public StudentViewModel StudentView
        {
            get
            {
                return ServiceLocator.Current.GetInstance<StudentViewModel>();
            }
        }

        public PopupViewModel PopupView
        {
            get
            {
                return ServiceLocator.Current.GetInstance<PopupViewModel>();
            }
        }
        public PlanLessonViewModel PlanLessonView
        {
            get
            {
                return ServiceLocator.Current.GetInstance<PlanLessonViewModel>();
            }
        }
        public SelectChapterViewModel SelectChapterView
        {
            get
            {
                return ServiceLocator.Current.GetInstance<SelectChapterViewModel>();
            }
        }


        public HomeViewModel HomeView
        {
            get
            {
                return ServiceLocator.Current.GetInstance<HomeViewModel>();
            }
        }
        public MainViewModel MainView
        {
            get
            {
                return ServiceLocator.Current.GetInstance<MainViewModel>();
            }
        }

        public LoginViewModel LoginView
        {
            get
            {
                return ServiceLocator.Current.GetInstance<LoginViewModel>();
            }
        }

        public static void Cleanup()
        {
            // TODO Clear the ViewModels
        }
    }
}